package com.atguigu.yygh.hosp.controller;


import com.atguigu.yygh.common.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@Api(tags = "登录相关")
@RestController
@RequestMapping("/admin/hosp/user")
//@CrossOrigin//允许跨域访问
public class UserController {

    @ApiOperation("登录")
    @PostMapping("/login")
    public R login(String username,String password){
        return R.ok().data("token","admin-token");
    }

    @ApiOperation("获取登录信息")
    @GetMapping("/info")
    public R info(String token){

        String [] roles={"admin"};
        return R.ok()
                .data("roles",roles)
                .data("introduction","我是管理员")
                .data("avatar","https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=GIF%E5%85%8D%E8%B4%B9%E5%9B%BE%E7%89%87&step_word=&hs=0&pn=29&spn=0&di=7360350738658099201&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=2785754712%2C3615481670&os=620093796%2C3214683872&simid=14594651%2C688519736&adpicid=0&lpn=0&ln=1246&fr=&fmq=1717581635464_R&fm=&ic=undefined&s=undefined&hd=undefined&latest=undefined&copyright=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=https%3A%2F%2Fimg.art.shenyecg.com%2FCrawler%2Fcb0e937e906e4d5d8290971b3e076534%2FQTQBAP2Q.gif&fromurl=ippr_z2C%24qAzdH3FAzdH3F5uustgj_z%26e3Bfijgyjv2_z%26e3Bv54AzdH3FA6ptvsjAzdH3F99cmdm&gsm=1e&rpstart=0&rpnum=0&islist=&querylist=&nojc=undefined&dyTabStr=MCwzLDEsMiw0LDYsNSw4LDcsOQ%3D%3D&lid=10909537772087552477")
                .data("name","超级管理员");

    }

    @ApiOperation("退出")
    @PostMapping("/logout")
    public R logout(){
        return R.ok().data("token","successs");
    }
}
